package com.xkcyy.study.mvc.controller;

import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * TestServlet
 *
 * @author yuand
 * @date 2021/6/21
 **/
@Component("/testServlet")
public class TestServlet implements Servlet {
    @Override
    public void init(ServletConfig servletConfig) throws ServletException {

    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        servletResponse.getOutputStream().write("aaa".getBytes(StandardCharsets.UTF_8));
        servletResponse.setContentType("text");
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {

    }
}
